<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $url = 'http://ip.taobao.com/service/getIpInfo.php?ip=';
        $ip = getIPaddress();
        $ipaddress =  json_decode(file_get_contents($url . $ip)) ; 
      if($ip != "220.114.232.1731"){
          $handle = fopen("./ip.txt", "a+");
          $nums = intval(file_get_contents("nums.txt")) + 1 ; 
          
          $str =  "您的IP地址是:" . $ip . "：".$ipaddress->data->city."----".$ipaddress->data->country.$ipaddress->data->isp . "宽带<br>" .
                    "您是第" .$nums. "访客" ."---当前时间：" .date("Y-m-d H:i:s" , time());
          echo $str ; 
          
            fwrite($handle, $str."\r\n") ; 
          file_put_contents("nums.txt", $nums++);
           fclose($handle) ; 
          
      }
        $this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover{color:blue;}</style><div style="padding: 24px 48px;"> <h1>爱周雨!</h1></b></p><br/></b><a href="http://www.aizhouyu.com/common/login">点击登录</a></b></div>');
     
        
      }
      
      function showmsg(){
        echo   file_get_contents('./ip.txt');
      }
      
      function taobao(){
          echo file_get_contents("http://www.taobao.com");
      }
      
}